﻿using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using System;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Xml.Schema;

namespace ScormModel
{
    [Serializable()]
    public class Resources
    {
        private List<Resource> _listResource;
         [NonSerialized]
        private XmlNode _resourcesContent;
        [XmlElement("resource")]
        public List<Resource> ListResource
        {
            get { return this._listResource; }
            set { this._listResource = value; }
        }
        
        [XmlIgnoreAttribute]
        public XmlNode ResourcesContent
        {
            get { return this._resourcesContent; }
            set { this._resourcesContent = value; }
        }
        public void buildResources()
        {
            XmlNodeList childList = _resourcesContent.ChildNodes;
            _listResource = new List<Resource>();
            for (int i = 0; i < childList.Count; i++)
            {
                if (childList[i].Name == "resource")
                {
                    Resource resource = new Resource();
                    resource.ResourceContent = childList[i];
                    resource.buildResource();
                    _listResource.Add(resource);
                }
            }	
        }
    }
}
